<%@page import="java.util.*"%>
<%@page import="QRCG.deneme"%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Sign Up Screen</title>

<link href="css/index.css" rel="stylesheet" type="text/css" />

<script src="datetimepicker_css.js"></script>

<style type="text/css">
body {
	background-image: url(images/bgNew.png);
	background-repeat: repeat;
	font-size: 80%;
	font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
}

H2 {
	COLOR: black;
	FONT-FAMILY: 'Times New Roman';
	TEXT-TRANSFORM: capitalize;
	font-size: 30px;
}
</style>
</head>

<body>

	<center>

		<%
			String name = (String) session.getAttribute("nickname");
			session.setAttribute("nickname", name);
		%>

		<table width="1100" border="0" cellpadding="1" bgcolor=white>
			<tr>
				<td>
					<!-- TABLE logo and head -->
					<table width="1100" border="0" cellpadding="1" bgcolor=white>
						<tr>
							<td width="250" align="center"><img src="images/logo.png"
								width="130" height="130" /></td>
							<td align="left"><h2>QR-MARKS-THE-SPOT!</h2></td>

							<td align="center"
								style="font: bold 16px tahoma; text-decoration: none; color: #00000; padding: 5px;">Logged
								as <font color=red><%=name%></font>
							</td>

							<td align="center"
								style="font: bold 16px tahoma; text-decoration: none; color: #00000; padding: 5px;"><a
								href="LogOut.jsp" onclick="return loadIframe('ifrm', this.href)">Logout</a></td>
						</tr>

					</table> <!-- LINK TABLE -->


					<table width="1100" border="0" cellpadding="20" bgcolor="#D6E9F3">
						<tr>
							<td align="center"
								style="font: bold 16px tahoma; text-decoration: none; color: #00000; padding: 5px;">
								Here is the List of Games</td>

						</tr>
					</table>

					<table border="1" id="tables">
						<tr>
							<th bgcolor="#b7b7b1" width="15%" align="center">Game</th>							
							<th bgcolor="#b7b7b1" width="15%" align="center">Description</th>
							<th bgcolor="#b7b7b1" width="15%" align="center">Creator Name</th>
							<th bgcolor="#b7b7b1" width="15%" align="center">Begin Date</th>
							<th bgcolor="#b7b7b1" width="15%" align="center">End Date</th>
						</tr>

						<%
							deneme connection = new deneme();
							connection.connect();

							//String id = connection.get_id(name);

							ArrayList<HashMap<String, Object>> games = new ArrayList<HashMap<String, Object>>();
							//games = connection.get_user_games(id);

							//if (!games.isEmpty()) {
							//	for (int i = 0; i < games.size(); i++) {
							//		HashMap<String, Object> map1 = (HashMap<String, Object>) games
								//			.get(i);
						%>

						<%
							games = connection.get_all_games();

							if (!games.isEmpty()) {
								for (int i = 0; i < games.size(); i++) {
									HashMap<String, Object> map1 = (HashMap<String, Object>) games
											.get(i);
						%>

						<tr>

							<td><%=map1.get("name")%></td>
							<td><%=map1.get("description")%></td>							
							<td><%=connection.get_nicknamefrom_id(map1.get("creator_id").toString())%></td>
							<td><%=map1.get("begin_date")%></td>
							<td><%=map1.get("end_date")%></td>
						</tr>

						<%
							}

							}
						%>

					</table>
	</center>

</body>
</html>
